home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / NAMEI.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  1KB  |  67 lines

  1. /* $Id: namei.h,v 1.13 1998/10/28 08:13:49 jj Exp $
  2.  * linux/include/asm-sparc64/namei.h
  3.  *
  4.  * Routines to handle famous /usr/gnemul/s*.
  5.  * Included from linux/fs/namei.c
  6.  */
  7.  
  8. #ifndef __SPARC64_NAMEI_H
  9. #define __SPARC64_NAMEI_H
  10.  
  11. #define SPARC_BSD_EMUL "usr/gnemul/sunos/"
  12. #define SPARC_SOL_EMUL "usr/gnemul/solaris/"
  13.  
  14. static inline struct dentry *
  15. __sparc64_lookup_dentry(const char *name, int lookup_flags)
  16. {
  17.     struct dentry *base;
  18.     char *emul;
  19.  
  20.     switch (current->personality) {
  21. #if 0
  22. /* Until we solve, why SunOS apps sometime crash, disable gnemul support for SunOS */
  23.     case PER_BSD:
  24.         emul = SPARC_BSD_EMUL; break;
  25. #endif        
  26.     case PER_SVR4:
  27.         emul = SPARC_SOL_EMUL; break;
  28.     default:
  29.         return NULL;
  30.     }
  31.  
  32.     base = lookup_dentry (emul, 
  33.                   dget (current->fs->root), 
  34.                   (LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_SLASHOK));
  35.             
  36.     if (IS_ERR (base)) return NULL;
  37.     
  38.     base = lookup_dentry (name, base, lookup_flags);
  39.     
  40.     if (IS_ERR (base)) return NULL;
  41.     
  42.     if (!base->d_inode) {
  43.         struct dentry *fromroot;
  44.         
  45.         fromroot = lookup_dentry (name, dget (current->fs->root), lookup_flags);
  46.         
  47.         if (IS_ERR (fromroot)) return base;
  48.         
  49.         if (fromroot->d_inode) {
  50.             dput(base);
  51.             return fromroot;
  52.         }
  53.         
  54.         dput(fromroot);
  55.     }
  56.     
  57.     return base;
  58. }
  59.  
  60. #define __prefix_lookup_dentry(name, lookup_flags)                \
  61.     if (current->personality) {                        \
  62.         dentry = __sparc64_lookup_dentry (name, lookup_flags);        \
  63.         if (dentry) return dentry;                    \
  64.     }
  65.  
  66. #endif /* __SPARC64_NAMEI_H */
  67.